from django.db import models

class User(models.Model):
	name = models.CharField( max_length = 10 )
	password = models.CharField( max_length = 20 )
	
	def __unicode__(self):
		return self.name

class Message(models.Model):
	author = models.ForeignKey( User )
	text = models.CharField( max_length = 140 )
	published_time = models.DateTimeField( 'published time of message' )

	def __unicode__(self):
		if len( self.text ) <= 13 :
			return self.text
		else:
			return self.text[:10] + '...'
